package com.cxkj.shop.biz;

import java.util.Map;

import net.wangds.comp.business.http.AbstractBaseHttpInteractionBusiness;

import com.cxkj.shop.form.DefaultDeliveryBuilder;
import com.cxkj.shop.form.Delivery;
import com.cxkj.shop.model.order.DefaultOrder;
import com.cxkj.shop.model.order.Order;
import com.cxkj.shop.utils.BusinessUtils;

public class UpdatePayTimeOrderBusiness   extends AbstractBaseHttpInteractionBusiness<Map<String,Object>, Delivery> {

	  /*
	   * @see net.wangds.comp.business.http.AbstractBaseHttpInteractionBusiness#process(java.lang.Object)
	   * @author wangds 2016年4月27日 下午3:00:26.
	   */
	  @Override
	  protected Delivery process(Map<String, Object> input) throws Exception {
	    Delivery res = null;
	    DefaultDeliveryBuilder<Boolean> builder = (DefaultDeliveryBuilder<Boolean>) DefaultDeliveryBuilder.<Boolean>getInstance();
	    try{
	      builder.init();

	      Order order = new DefaultOrder();
	      
	      String orderId=String.valueOf(input.get("orderId"));
	      order.setOrderId(orderId);
	      order.setPostTm(System.currentTimeMillis());
	      builder.setData(BusinessUtils.setUpdatePayTimeOrder(order));
	      
	      builder.success();
	    } catch(Exception e){
	      builder.fail();
	      this.getLogger().error(e.getLocalizedMessage(),e);
	    } finally{
	      res = builder.toDelivery();
	      builder.clear();
	    }
	    return res;
	  }
}
